/**
* @brief 构建一个PDF阅读器控制模块。这个模块中包含了阅读部分，也就是显示PDF
*    内容部分；控制部分，比如说跳转页面选择操作接口，缩放操作选择接口
* @version 0.1
* @author 宋炜
* @date 2016-12-16
* @note
*/
#ifndef CPDFPANEL_H
#define CPDFPANEL_H

#include <wx/panel.h>
#include <wx/textctrl.h>
#include <wx/button.h>
#include <wx/slider.h>
//做鼠标右键菜单
//如果需要做阅读器菜单或者其他操作接口，需要在外部程序进行
#include <wx/menu.h>

class CPdfReader;

class CPdfPanel : public wxPanel
{
  DECLARE_EVENT_TABLE()
public:
  CPdfPanel();
  CPdfPanel(wxWindow* parent,
	    wxWindowID id = wxID_ANY,
	    const wxPoint& pos = wxDefaultPosition,
	    const wxSize& size = wxDefaultSize,
	    long style = wxTAB_TRAVERSAL,
	    const wxString& name = _("PDF Panel") );

  virtual ~CPdfPanel();
  void NextPage();
  void PrePage();
  void Scale( double s=1.0 );
  void GotoPage( int index );
  void FirstPage();
  void EndPage();

  int GetCurrentPage();
  void SetCurrentPage( int index );
  /**
   * @brief 以下是响应操作接口事件的内容
   */
  void OnNextPage( wxCommandEvent& evt );
  void OnPrePage( wxCommandEvent& evt );
  void OnScale( wxScrollEvent& evt );
  void OnFirstPage( wxCommandEvent& evt );
  void OnEndPage( wxCommandEvent& evt );
  void OnTextPage( wxCommandEvent& evt );
  void OnRotateLeft( wxCommandEvent& evt );
  void OnRotateRight( wxCommandEvent& evt );

  void OnMouseRight( wxMouseEvent& evt );

  void OnOpenFile( wxCommandEvent& evt );
  void OnCloseFile( wxCommandEvent& evt );

  void _OnSize( wxSizeEvent& evt );

  void SetPages( int page , int sum );
private:
  /// @brief 构建鼠标右键菜单
  void create_right_menu();
private:
  wxMenu *p_menu;
  CPdfReader *p_reader;

  wxButton *ButtonNext;
  wxButton *ButtonPre;
  wxButton *ButtonFirst;
  wxButton *ButtonEnd;
  wxButton *ButtonLeft;
  wxButton *ButtonRight;
  wxTextCtrl *TextPage;
  wxSlider   *SliderScale;
private:
  static const long BUTTON_PRE_PAGE;
  static const long BUTTON_NEXT_PAGE;
  static const long BUTTON_FIRST_PAGE;
  static const long BUTTON_END_PAGE;
  static const long SLIDER_SCALE;
  static const long TEXT_PAGE_NUM;
  static const long BUTTON_ROTATE_LEFT;
  static const long BUTTON_ROTATE_RIGHT;

  static const long MENU_ID_OPEN_FILE;
  static const long MENU_ID_CLOSE_FILE;
  static const long MENU_ID_NEXT_PAGE;
  static const long MENU_ID_PRE_PAGE;
  static const long MENU_ID_FIRST_PAGE;
  static const long MENU_ID_END_PAGE;
  static const long MENU_ID_ROTATE_LEFT;
  static const long MENU_ID_ROTATE_RIGHT;

  static const long ID_PDF_READER;

  static const long BUTTON_WIDTH;        //控件宽度
  static const long CTRL_POS_OFFSET;     //控件最左边坐标偏移量
};

#endif // CPDFPANEL_H
